<?php

class Doctrine_Model_BaseDao {

    public function getEntityManager() {
        if (Zend_Registry::isRegistered('em')) {
            return Zend_Registry::get('em');
        }
        return null;
    }

    public function toArrayCollection($coleccion) {
        $arrayCollection = new \Doctrine\Common\Collections\ArrayCollection();

        if (is_array($coleccion)) {
            foreach ($coleccion as $objeto) {
                $arrayCollection->add($objeto);
            }
        } else {
            if ($coleccion != NULL) {
                $arrayCollection->add($coleccion);
            }
        }
        return $arrayCollection;
    }

}

